Skip to content

gh-149716: Document PySlot_DATA for Py_mod_gil and Py_mod_multiple_interpreters#150053

Open
Taeknology wants to merge 1 commit into
python:mainfrom
Taeknology:gh-149716-document-mod-gil-multiple-interp-slot-macro
Open

gh-149716: Document PySlot_DATA for Py_mod_gil and Py_mod_multiple_interpreters#150053
Taeknology wants to merge 1 commit into
python:mainfrom
Taeknology:gh-149716-document-mod-gil-multiple-interp-slot-macro

Conversation

@Taeknology
Copy link
Copy Markdown

@Taeknology Taeknology commented May 19, 2026

Fixes #149716.

Summary

Adds short code examples to the documentation of two module slot IDs
(Py_mod_gil since 3.13, Py_mod_multiple_interpreters since 3.12).
The examples mirror the existing one under Py_mod_abi and make it
explicit that PySlot_DATA (not PySlot_INT64 / PySlot_UINT64)
is the correct slot-definition macro for these two slots, because
their values (Py_MOD_GIL_*, Py_MOD_MULTIPLE_INTERPRETERS_*,
Py_MOD_PER_INTERPRETER_GIL_SUPPORTED) are defined as (void *)N
in Include/moduleobject.h, and PySlot_DATA casts to void *
(Include/slots.h).

Changes

  • Doc/c-api/module.rst: add a PySlot_DATA(...) code-block to each
    of the two slot sections, in the same 4-part style (intro sentence +
    .. code-block:: c + 6-space code + .. versionadded::) as the
    existing Py_mod_abi example.

The Py_mod_multiple_interpreters example shows
Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (rather than the default
_SUPPORTED) since that is the value extension authors most often need
to set explicitly. Likewise the Py_mod_gil example shows
Py_MOD_GIL_NOT_USED (rather than the default _USED).

Notes

  • Docs-only change; no Misc/NEWS.d entry per the
    devguide.
  • RST format mirrors Py_mod_abi byte-for-byte (3-space body
    indentation, 6-space code indentation, identical directive order).

…ple_interpreters

Add short code examples mirroring the existing Py_mod_abi example,
so it is clear which slot definition macro (PySlot_DATA, PySlot_INT64,
or PySlot_UINT64) to use for these two slots.
@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented May 19, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32751027 | 📁 Comparing 7cbcf37 against main (68ebc05)

  🔍 Preview build  

1 file changed
± c-api/module.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Unclear which slot definition macro to use

1 participant